<?php
foreach ($topicList as $topicMsg) {
    if (isset($topicMsg->Picture))
        $workImg = make_img_name::make_img_mini_name(explode(';', $topicMsg->Picture, 2)[0]);
    else
        $workImg = '';
    if ($InputData['list_type'] == topic_m::ListCheck) {
        $topicCheckUrlPara = "&topic_work_check={$topicMsg->TopicId}";
    } elseif ($InputData['list_type'] == topic_m::ListChecked) {
        $topicCheckUrlPara = "&topic_work_check=0";
    } else {
        //检查当前用户是否已经点赞了此作品
        if (!isset($myWork)) {
            require_once("{$CfgPara->root}/model/work.m.php");
            $myWork = new work_m();
        }
        $isRecommend = $myWork->work_recommend_check($topicMsg->WorkId);
        if ($isRecommend === true) $recommendIconEx = ''; else $recommendIconEx = '-o';
        $topicCheckUrlPara = '';
    }
    ?>
    <div id="topic_<?= $topicMsg->TopicId ?>_work_<?= $topicMsg->WorkId ?>"
         class="app-gray-background am-text-xs am-u-sm-6"
         style="padding: 5px;">
        <div class="app-white-background" style="border: 1px solid #dedede;">
            <div style="margin-top: 5px;margin-bottom: 5px;padding-left: 10px;">
                <span class="app-gray-color">专题：</span>
                <a onclick="goto_topic_show(<?= $topicMsg->TopicId ?>)" class="app-main-color">
                    <span class="topic_check_name"><?= $topicMsg->TopicName ?></span>
                </a>
            </div>
            <a onclick="goto_work_show(<?= $topicMsg->WorkId ?>)">
                <div class="app-img-flex"
                     style="background-image:url(<?= "{$CfgPara->httproot}/works_pic/{$workImg}" ?>);"></div>
            </a>
            <div style="padding: 5px 10px">
                <b class="work_check_name"><?php
                    if (isset($topicMsg->WorkName)) {
                        echo $topicMsg->WorkName;
                    } else {
                        echo "此专题尚无作品";
                    }
                    ?></b>
            </div>
            <div style="padding:0px 10px; height:25px">
                <?php if (isset($topicMsg->WorkId)) { ?>
                    <span class="app-main-color am-fl">
                <?= $topicMsg->UserName ?>
            </span>
                    <span class="am-fr app-gray-color">
                <?php
                if ($topicCheckUrlPara == '') {
                    echo "{$topicMsg->UpCount}&nbsp;<i class='am-icon-heart{$recommendIconEx}'></i>";
                } elseif ($InputData['list_type'] == topic_m::ListCheck) {
                    echo '<a data-topic="' . $topicMsg->TopicId . '" data-work="' . $topicMsg->WorkId . '" onclick="topic_work_check_action(this);"><b>&middot;&middot;&middot;</b></a>';
                }
                ?>
            </span>
                <?php } ?>
            </div>
        </div>
    </div>
    <?php
}
?>